<template>
  <div class="a">
    <!-- <div class="topbar">12</div> -->
    <div v-html="alipayWap" ref="alipay"></div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      sn: "",
      alipayWap: "", // store
    };
  },
  components: {},
  onLoad(option) {
    if (option.sn) {
      this.sn = option.sn;
    }
  },
  created() {},
  mounted() {
    const url = "http://api.0xing.cn/app/order/pay?orderSn=";

    let params = {
      sn: this.sn,
      returnUrl:''
    };

    if (process.env.NODE_ENV === "development") {
      // console.log("开发环境");
      params.returnUrl = "http://localhost:8080/#/pages/orders/orders"
    } else {
      // console.log("生产环境");
      params.returnUrl = "http://user.0xing.cn/#/pages/orders/orders";
    }

    // return;
    this.$u.api
      .payOrder(params)
      .then((res) => {
        this.alipayWap = res.substr();
      })
      .then((res) => {
        console.log(this.$refs.alipay);
        this.$refs.alipay.children[0].submit();
      });
  },
  methods: {
    init() {
      let that = this;
      // that.alipayWap = that
    },
  },
};
</script>

<style scoped>
</style>
